package com.ctrip.demo.leetcode;

import java.util.Stack;

/**
 * @author xs.wu
 */
public class Leetcode1614 {

    public static void main(String[] args) {
        System.out.println(maxDepth("(1+(2*3)+((8)/4))+1"));
    }


    public static int maxDepth(String s) {

        int max = 0, num = 0;

        char[] chars = s.toCharArray();


        for (char c : chars) {
            if (c =='(') {
                num ++;
            }

            if (c == ')') {
                num --;
            }

            max = Math.max(max, num);
        }

        return max;

    }
}
